<template>
<div class="product-add">
    <!--form表单-->
    <el-form size="small" ref="form" :model="form" label-width="250px">

      <div class="common-form">{{$t('appsetting.alipay_payment_settings')}}</div>
      <el-form-item :label="$t('appsetting.is_enabled')" prop="customer">
        <el-checkbox v-model="form.is_open">{{$t('appsetting.enable_alipay')}}</el-checkbox>
      </el-form-item>
      <el-form-item :label="$t('appsetting.alipay_appid')">
        <el-input v-model="form.app_id" class="max-w460"></el-input>
      </el-form-item>
      <el-form-item :label="$t('appsetting.alipay_public_key')">
        <el-input type="textarea" :rows="4" v-model="form.publicKey" class="max-w460"></el-input>
      </el-form-item>
      <el-form-item :label="$t('appsetting.alipay_private_key')">
        <el-input type="textarea" :rows="4" v-model="form.privateKey" class="max-w460"></el-input>
      </el-form-item>

      <!--提交-->
      <div class="common-button-wrapper">
          <el-button type="primary" @click="onSubmit">{{$t('appsetting.submit')}}</el-button>
      </div>
    </el-form>

  </div>
</template>

<script>
import AppSettingApi from '@/api/appsetting.js';
export default {
  data() {
    return {
      /*form表单数据*/
      form: {},
      /*是否打开图片选择*/
      isupload: false
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      let self = this;
      AppSettingApi.h5AlipayDetail({}, true).then(data => {
        if (data.data.data != null) {
          self.form = data.data.data;
        }
      }).catch(error => {});
    },
    //提交表单
    onSubmit() {
      let self = this;
      let params = this.form;
      AppSettingApi.editH5Alipay(params, true).then(data => {
        ElMessage({
          message: $t("appsetting.setup_success"),
          type: 'success'
        });
      }).catch(error => {});
    }
  }
};
</script>

<style>
.tips {
    color: #ccc;
  }
</style>

